home *** CD-ROM | disk | FTP | other *** search
-
- #ifndef _WIN_
- #define _WIN_
-
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifndef __FILES__
- #include <Files.h>
- #endif
-
- #ifndef __EVENTS__
- #include <Events.h>
- #endif
-
- #ifndef PIGS_SHELL_NOPRINT
- #ifndef __PRINTING__
- #include <Printing.h>
- #endif
-
- #ifndef __GXPRINTING__
- #include <GXPrinting.h>
- #endif
- #endif
-
-
- /**\
- |**| ==============================================================================
- |**| PUBLIC DEFINES
- |**| ==============================================================================
- \**/
- #define kDocumentCreator 'ASDF'
- #define kWasAlreadyOpen 128
-
-
- /**\
- |**| ==============================================================================
- |**| PUBLIC TYPEDEFS
- |**| ==============================================================================
- \**/
- typedef struct _winRecord winRecord, *winPtr, **winHandle ;
-
- /*------------------------------------------------------------------------------*\
- typedefs for the procptrs used by the framework.
- \*------------------------------------------------------------------------------*/
- typedef void (*ActivateProcPtr) ( winHandle win, Boolean activating ) ;
- typedef void (*ResumeProcPtr) ( winHandle win, Boolean resuming ) ;
- typedef void (*UpdateProcPtr) ( winHandle win, EventRecord *e) ;
- typedef void (*ClickProcPtr) ( winHandle win, EventRecord *e) ;
- typedef void (*KeyProcPtr) ( winHandle win, EventRecord *e) ;
- typedef void (*NullProcPtr) ( winHandle win, EventRecord *e) ;
- typedef void (*MenuProcPtr) ( winHandle win, long m, Boolean *didit) ;
- typedef void (*UpdateMenusProcPtr) ( winHandle win ) ;
- typedef void (*ResizeProcPtr) ( winHandle win ) ;
- typedef OSErr (*AllocProcPtr) ( winHandle win ) ;
- typedef OSErr (*NewProcPtr) ( winHandle win ) ;
- typedef OSErr (*OpenProcPtr) ( winHandle win ) ;
- typedef void (*CloseProcPtr) ( winHandle win ) ;
- typedef void (*DisposeProcPtr) ( winHandle win ) ;
- #ifndef PIGS_SHELL_NOPRINT
- typedef OSErr (*PageCountProcPtr) ( winHandle win, short *pageCount ) ;
- typedef OSErr (*PagePrintProcPtr) ( winHandle win, GrafPtr imagingPort, short pageNum ) ;
- #endif
- /*------------------------------------------------------------------------------*\
- winRecord structure used by the framework.
- \*------------------------------------------------------------------------------*/
- struct _winRecord {
- // type & creator of the windows
- OSType Creator ; // always 'ASDF' - helps to verify that it is our window
- OSType Type ; // this is the type of window (eg 'Pict' 'Abou', etc.)
- OSType Subtype ; // this is the type is free for each window type to use
-
- // pocedure pointers
- ActivateProcPtr ActivateProc;
- ResumeProcPtr ResumeProc;
- UpdateProcPtr UpdateProc;
- ClickProcPtr ClickProc;
- KeyProcPtr KeyProc;
- NullProcPtr NullProc;
- MenuProcPtr MenuProc;
- UpdateMenusProcPtr UpdateMenusProc;
- ResizeProcPtr ResizeProc;
- AllocProcPtr AllocProc;
- NewProcPtr NewProc;
- OpenProcPtr OpenProc;
- CloseProcPtr CloseProc;
- DisposeProcPtr DisposeProc;
- #ifndef PIGS_SHELL_NOPRINT
- PageCountProcPtr PageCountProc;
- PagePrintProcPtr PagePrintProc;
- #endif
-
- // basic necessities
- FSSpec FSSpec ; // file spec for the win, we don't keep it open
- WindowRef Window ; // the graf port/window for the document
- Rect Rect ; // the bounds of the document
- Rect SizeRect ; // the max/min size of the document
- Boolean Dirty ; // true if the file needs to be saved
-
- #ifndef PIGS_SHELL_NOPRINT
- // print data record (classic & GX)
- THPrint PrintRec ; // a print record for the document
- gxJob GXJob ; // stores a reference to the win's job format
- #endif
-
- //content data
- Handle Data; // handle to whatever data this document needs
-
- } ;
-
- typedef struct AllocProcMap
- {
- OSType type ;
- AllocProcPtr AllocProc ;
- Boolean printable ;
- Boolean autoNew ;
- } AllocProcMapRec, *AllocProcMapPtr, **AllocProcMapHdl ;
-
-
-
- /**\
- |**| ==============================================================================
- |**| PUBLIC FUNCTION PROTOTYPES
- |**| ==============================================================================
- \**/
- OSErr NewWinHandle ( winHandle *win, AllocProcPtr allocProc ) ;
- OSErr DisposeWinHandle ( winHandle win ) ;
-
- winHandle GetWindowWinHandle ( WindowRef w ) ;
- void SetWindowWinHandle ( WindowRef w, winHandle win ) ;
-
- winHandle GetFrontWindowWinHandle ( void ) ;
- winHandle FrontWin ( void ) ;
- winHandle GetNextWin ( winHandle win ) ;
-
- short FindWinHandle ( FSSpec *specPtr,
- OSType type,
- OSType subtype,
- short index,
- short count,
- winHandle *result ) ;
-
- static Boolean SameFSSpec ( FSSpec *fs1, FSSpec *fs2 ) ;
-
- OSType GetWinCreator ( winHandle win ) ;
- void SetWinCreator ( winHandle win, OSType creator ) ;
-
- OSType GetWinType ( winHandle win ) ;
- void SetWinType ( winHandle win, OSType type ) ;
-
- OSType GetWinSubtype ( winHandle win ) ;
- void SetWinSubtype ( winHandle win, OSType type ) ;
-
- FSSpec GetWinFSSpec ( winHandle win ) ;
- void SetWinFSSpec ( winHandle win, FSSpec *theFSSpec ) ;
-
- WindowRef GetWinWindow ( winHandle win ) ;
- void SetWinWindow ( winHandle win, WindowRef theWindow ) ;
-
- Rect GetWinRect ( winHandle win ) ;
- void SetWinRect ( winHandle win, Rect theRect ) ;
-
- Rect GetWinSizeRect ( winHandle win ) ;
- void SetWinSizeRect ( winHandle win, Rect theRect ) ;
-
- Boolean GetWinDirty ( winHandle win ) ;
- void SetWinDirty ( winHandle win, Boolean dirty ) ;
-
- #ifndef PIGS_SHELL_NOPRINT
-
- THPrint GetWinPrintRec ( winHandle win ) ;
- void SetWinPrintRec ( winHandle win, THPrint thePrintRec ) ;
-
- gxJob GetWinGXJob ( winHandle win ) ;
- void SetWinGXJob ( winHandle win, gxJob theGXJob ) ;
-
- #endif
-
- Handle GetWinData ( winHandle win ) ;
- void SetWinData ( winHandle win, Handle h ) ;
-
-
- void CallWinActivateProc ( winHandle win, Boolean activating ) ;
- void SetWinActivateProc ( winHandle win, ActivateProcPtr f ) ;
-
- void CallWinResumeProc ( winHandle win, Boolean resuming ) ;
- void SetWinResumeProc ( winHandle win, ResumeProcPtr f ) ;
-
- void CallWinUpdateProc ( winHandle win, EventRecord *e ) ;
- void SetWinUpdateProc ( winHandle win, UpdateProcPtr f ) ;
-
- void CallWinClickProc ( winHandle win, EventRecord *e ) ;
- void SetWinClickProc ( winHandle win, ClickProcPtr f ) ;
-
- void CallWinKeyProc ( winHandle win, EventRecord *e ) ;
- void SetWinKeyProc ( winHandle win, KeyProcPtr f ) ;
-
- void CallWinNullProc ( winHandle win, EventRecord *e ) ;
- void SetWinNullProc ( winHandle win, NullProcPtr f ) ;
-
- void CallWinMenuProc ( winHandle win, long m, Boolean *didit ) ;
- void SetWinMenuProc ( winHandle win, MenuProcPtr f ) ;
-
- void CallWinUpdateMenusProc ( winHandle win ) ;
- void SetWinUpdateMenusProc ( winHandle win, UpdateMenusProcPtr f ) ;
-
- void CallWinResizeProc ( winHandle win ) ;
- void SetWinResizeProc ( winHandle win, ResizeProcPtr f ) ;
-
- OSErr CallWinAllocProc ( winHandle win ) ;
- void SetWinAllocProc ( winHandle win, AllocProcPtr f ) ;
-
- OSErr CallWinNewProc ( winHandle win ) ;
- void SetWinNewProc ( winHandle win, NewProcPtr f ) ;
-
- OSErr CallWinOpenProc ( winHandle win ) ;
- void SetWinOpenProc ( winHandle win, OpenProcPtr f ) ;
-
- void CallWinCloseProc ( winHandle win ) ;
- void SetWinCloseProc ( winHandle win, CloseProcPtr f ) ;
-
- void CallWinDisposeProc ( winHandle win ) ;
- void SetWinDisposeProc ( winHandle win, DisposeProcPtr f ) ;
-
- #ifndef PIGS_SHELL_NOPRINT
-
- OSErr CallWinPageCountProc ( winHandle win, short *pageCount ) ;
- void SetWinPageCountProc ( winHandle win, PageCountProcPtr f ) ;
-
- OSErr CallWinPagePrintProc ( winHandle win, GrafPtr imagingPort, short pageNum ) ;
- void SetWinPagePrintProc ( winHandle win, PagePrintProcPtr f ) ;
-
- #endif
-
- OSErr CallAllWinNullProcs ( EventRecord *event ) ;
- OSErr CallAllWinResumeProcs ( Boolean resuming ) ;
- OSErr CallAllWinUpdateMenusProcs ( void ) ;
- OSErr CallAllWinMenuProcs ( long m, Boolean *didit ) ;
-
-
- #endif